home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / TYPES.MOD < prev    next >
Text File  |  1989-01-18  |  1KB  |  44 lines

  1.                                          (* Chapter 6 - Program 3 *)
  2. MODULE Types;
  3.  
  4. TYPE  ArrayDef   = ARRAY[12..25] OF INTEGER;
  5.       CharDef    = ARRAY[0..27] OF CHAR;
  6.       RealArray  = ARRAY[-17..42] OF REAL;
  7.       DogFood    = ARRAY[1..6] OF BOOLEAN;
  8.       Airplane   = ARRAY[1..12] OF DogFood;
  9.       Boat       = ARRAY[1..12],[1..6] OF BOOLEAN;
  10.  
  11. VAR   Index,Counter : CARDINAL;
  12.       Stuff         : ArrayDef;
  13.       Stuff2        : ArrayDef;
  14.       Stuff3        : ARRAY[12..25] OF INTEGER;
  15.       Puppies       : Airplane;
  16.       Kitties       : Boat;
  17.  
  18. BEGIN
  19.    FOR Index := 1 TO 12 DO
  20.       FOR Counter := 1 TO 6 DO
  21.          Puppies[Index,Counter] := TRUE;
  22.          Kitties[Index,Counter] := NOT Puppies[Index,Counter];
  23.       END;
  24.    END;
  25.  
  26.    FOR Index := 12 TO 25 DO
  27.       Stuff[Index] := Index*4 + 13;
  28.    END;
  29.  
  30.    Stuff2 := Stuff;    (* all 14 values copied *)
  31. (* Kitties := Puppies;    illegal, types are not compatible *)
  32.  
  33. END Types.
  34.  
  35.  
  36.  
  37.  
  38. (* Result of execution
  39.  
  40. (There is no output from this program.)
  41.  
  42. *)
  43.  
  44.